home *** CD-ROM | disk | FTP | other *** search
Wrap
-- Image Cycle Members -- n state cycling, bounce list -- relies on cast members being contiguous -- exports SetState and CycleState -- if receives a CycleState event, it checks it's name and increments the state -- behavior library version 1.1 property Enabled property MemberMin, MemberMax, ImageCastLib, MemberRefMin, MemberRefMax property CycleStyle -- cycling, bouncing -- memberMin and memberMax are actually membernumbers, as is currentstate property goingDown -- TRUE if going through the list in reverse order -- FALSE if traversing the list normally property CurrentState property NumStates property name on CycleState me, name if name = the name of me then bumpstate_intern me end if end on SetState me, statenum if the enabled of me then if statenum > the numstates of me then set statenum = the numstates of me else if statenum < 1 then set statenum = 1 end if set the member of sprite the spritenum of me = member ( the membermin of me + statenum - 1 ) of castLib imageCastLib end if end on setGoingDown me, value set the goingDown of me to value end on SetCycleStyle me, value set the CycleStyle of me to value end --- on bumpstate_intern me if the enabled of me then if ( the CycleStyle of me = #Repeat ) then if NOT the goingDown of me then -- going Up set curr = the currentstate of me + 1 if curr > the numstates of me then set curr = 1 end if else -- going Down set curr = the currentstate of me - 1 if curr < 1 then set curr = the numstates of me end if else -- Reverse cycle if NOT the goingDown of me then -- going Up set curr = the currentstate of me + 1 if curr > the numstates of me then set curr = curr - 2 set the goingDown of me = TRUE end if else -- going Down set curr = the currentstate of me - 1 if curr < 1 then set curr = 2 set the goingDown of me = FALSE end if end if end if set the currentstate of me = curr setstate me, curr end if end on BeginSprite me set the enabled of me = TRUE set the membermin of me = the membernum of member memberRefMin set the membermax of me = the membernum of member memberRefMax set the numstates of me = (the membermax of me) - (the membermin of me) + 1 set the currentState of me = ( the memberNum of sprite the spriteNum of me ) - the MemberMin of me + 1 set the imageCastLib of me = the number of castLib ( the castLibNum of sprite ( the spriteNum of me )) setstate me, the currentstate of me end on getPropertyDescriptionList if the currentspritenum = 0 then set memdefault = 0 else set memref = the member of sprite the currentspritenum set castlibnum = the castlibnum of memref set memdefault = member (the membernum of member memref + 1) of castlib castlibnum end if set p_list = [ #Name: [ #comment: "Item Name:", #format: #symbol, #default: #MultiState_1 ], #MemberRefMin: [ #comment: "First Image:", #format: #graphic, #default: memref ], #MemberRefMax: [ #comment: "Last Image:", #format: #graphic, #default: memdefault ], #CycleStyle: [ #comment: "Cycle Style:", #format: #symbol, #range: [ #Repeat, #Reverse ], #default: #Repeat ], #GoingDown: [ #comment: "Reverse Order:", #format: #boolean, #default: FALSE ] ] return p_list end on getBehaviorDescription return "Makes the sprite cycle through a range of cast members when the CycleState message is received." & RETURN & "PARAMETERS:" & RETURN & "ï Item Name - (optional) Enter an item name to identify the current sprite so that it can receive a specific message. Do not use spaces. Use the name as an argument for the Message Sprite or Message All Sprites behaviors." & RETURN & "ï First Image - Enter the name of the first cast member in the cycling range." & RETURN & "ï Last Image - Enter the name of the last cast member in the cycling range." & RETURN & "ï Cycle Mode - Choose Repeat to repeat the same sequence. Choose Reverse to cycle back through the sequence in reverse order." & RETURN & "ï Reverse Order - Turn this option on to proceed from the last to the first image by default." & RETURN & "MESSAGES:" & RETURN & "ï CycleState - Switches the sprite's cast member to the next image in the sequence." & RETURN & "ï SetState state_number - Advances directly to the position in the sequence identified by state_number." end